10. Style
Style
A consistent style (hopefully) helps improve and make your code more readable.
There are many different C++ styles, none of which is authoritative.
- C++ Core Guidlines: Naming and layout rules
- Google C++ Style Guide
- Mozilla Coding Style: C/C++ practices
ClangFormat
clang-format
is a command line text formatter that automatically reformats source code according to configurable set of policies. The tool includes several pre-configured styles, or you can create your own.
clang-format
is an open-source application that you can install on your system, or it is straightforward to install as a Visual Studio Code extension.
Visual Studio Code ClangFormat